package com.addcn.fog.utils {
	import com.addcn.fog.utils.Version;
	import com.addcn.fog.utils.mvcError;
	/**
	 * 输出提示
	 * 
	 */	
	public class PaperLogger {				
		static private var m_instance:PaperLogger = null;

		protected var m_traceLogger:Object;
		private var debug : Boolean = true;
		
		public function PaperLogger() {
			if (m_instance != null) {
				throw new mvcError(mvcError.SINGLETON_PAPERLOGGER_MSG, PaperLogger);
			}
			addLogger(Log);
		}
		
		static public function getInstance():PaperLogger {
			if (m_instance == null) {
				m_instance = new PaperLogger();
			}
			return m_instance;
		}
		
		public function addLogger(logger:Class):void {
			if (logger && (logger.record != null)) {
				m_traceLogger = logger;
			}
		}
		
		public function removeLogger():void {
			if (m_traceLogger) {
				m_traceLogger = null;
			}
		}
		
		public function log(errorMsg:String, currentClass:Class = null, ... rest):void {
			if(debug){
				m_traceLogger.record(mvcError.formatMessage("MVC Warning# ", errorMsg, currentClass, rest));
			}
		}
	}
}

internal class Log {
	
	public static function record(msg:String):void {
		trace(msg);
	}
}
